/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package test2.test2;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import modele.Medecin;

/**
 *
 * @author sio
 */
public class MedAdapter extends BaseAdapter{
    
    private List<Medecin> lesMeds;
    private Context c;
    
    MedAdapter(List data, Context c){
        lesMeds=data;
        this.c=c;
    }
    
    public int getCount(){
        return lesMeds.size();
    }
    
    public Object getItem(int i){
        return lesMeds.get(i);
    }
    
    public long getItemId(int i){
        return i;
    }
    
    public View getView(int i, View v, ViewGroup vg){
        LayoutInflater vi=(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v=vi.inflate(R.layout.lignemed,null);
        TextView nom=(TextView) v.findViewById(R.id.nom);
        TextView prenom=(TextView) v.findViewById(R.id.prenom);
        TextView adr=(TextView) v.findViewById(R.id.adr);
        TextView tel=(TextView) v.findViewById(R.id.tel);
        TextView spe=(TextView) v.findViewById(R.id.spe);
        Medecin leMed=lesMeds.get(i);
        nom.setText(leMed.getNom());
        prenom.setText(leMed.getPrenom());
        adr.setText(leMed.getAdr());
        tel.setText(leMed.getTel());
        spe.setText(leMed.getSpe());
        return v;
    }
        
}
